﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DLL;
using Module;

namespace BLL
{
    public class BPaper
    {
        #region 字段

        private DPaper APP = new DPaper();//数据操作对象
        private static BPaper instance;

        #endregion

        #region 公共接口
        /// <summary>
        /// 取得
        /// </summary>
        /// <returns>BPaper对象</returns>
        public static BPaper getInstance()
        {
            if (instance == null)
            {
                instance = new BPaper();
            }
            return instance;
        }
         /// <summary>
        /// 添加
        /// </summary>
        /// <param name="userProfileInfo"></param>
        /// <returns></returns>
        public bool Insert(PaperInfo paperInfo)
        {
            if (paperInfo == null || paperInfo.UserPassportId == 0)
                return false;
            return APP.Insert(paperInfo);
        }
         /// <summary>
        /// 更新
        /// </summary>
        /// <param name="paperInfo"></param>
        /// <returns></returns>
        public bool Update(PaperInfo paperInfo)
        {
             if (paperInfo == null || paperInfo.UserPassportId == 0)
                return false;
             return APP.Update(paperInfo);

        }

         /// <summary>
        /// 根据文章Id获取文章
        /// </summary>
        /// <param name="paperId"></param>
        /// <returns></returns>
        public PaperInfo GetPaperInfo(long paperId)
        {
            if (paperId == 0 || paperId.ToString().Length != 18)
                return null;
            return APP.GetPaperInfo(paperId);

        }

        
        /// <summary>
        /// 获取所有文章
        /// </summary>
        /// <returns></returns>
        public List<PaperInfo> GetAllPage()
        {
            return APP.GetAllPage();
        }

        /// <summary>
        /// 获取所有政策文件
        /// </summary>
        /// <returns></returns>
        public List<PaperInfo> GetAllPolicyPage()
        {
            return APP.GetAllPolicyPage();
        }
         /// <summary>
        /// 获取前10条政策文件
        /// </summary>
        /// <returns></returns>
        public List<PaperInfo> GetAllPolicyPageTop10()
        {
            return APP.GetAllPolicyPageTop10();
        }

         /// <summary>
        /// 获取所有会员动态文件
        /// </summary>
        /// <returns></returns>
        public List<PaperInfo> GetAllUserRelationPage()
        {
            return APP.GetAllUserRelationPage();
        }

        /// <summary>
        /// 获取前10条会员动态文件
        /// </summary>
        /// <returns></returns>
        public List<PaperInfo> GetAllUserRelationPageTop10()
        {
            return APP.GetAllUserRelationPageTop10();
        }

         /// <summary>
        /// 根据RegionCategoryId 获取相应的文章
        /// </summary>
        /// <param name="regionCategoryId"></param>
        /// <returns></returns>
        public List<PaperInfo> GetAllRegionCategoryPage(long regionCategoryId)
        {
            if (regionCategoryId == 0)
                return null;
            return APP.GetAllRegionCategoryPage(regionCategoryId);
        }

        /// <summary>
        /// 根据CategoryType获取相应的文章
        /// </summary>
        /// <param name="regionCategoryId"></param>
        /// <returns></returns>
        public List<PaperInfo> GetPapersByCategoryType(int CategoryType)
        {
            if (CategoryType == 0)
                return null;
            return APP.GetPapersByCategoryType(CategoryType);
        }

         /// <summary>
        /// 根据RegionCategoryId 获取相应的前10条文章
        /// </summary>
        /// <param name="regionCategoryId"></param>
        /// <returns></returns>
        public List<PaperInfo> GetAllRegionCategoryTop10(long regionCategoryId)
        {
            if (regionCategoryId == 0)
                return null;
            return APP.GetAllRegionCategoryTop10(regionCategoryId);
        }
        #endregion
    }
}
